<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>欢迎使用专家特贴系统</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content" id="index">

    <!--登录信息-->
    <input name="userid" th:value="${session.userid}" type="hidden" id="userid">
    <input name="username" th:value="${session.username}" type="hidden" id="username">
    <input name="deptid" th:value="${session.deptid}" type="hidden" id="deptid">
    <input name="olddeptid" th:value="${session.olddeptid}" type="hidden" id="olddeptid">
    <input name="deptname" th:value="${session.deptname}" type="hidden" id="deptname">
    <input name="jigoujibie" th:value="${session.jigoujibie}" type="hidden" id="jigoujibie">
    <input name="roleid" th:value="${session.roleid}" type="hidden" id="roleid">

    <div class="col-sm-12">

        <div class="row" style="padding-left:20px;margin-bottom: 20px;">
            <h2 v-text="welcomeText" style="font-weight: bold"></h2>
        </div>

<!--        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>须知</h5>
                    </div>
                    <div class="ibox-content">

                        <div class="row">
                            <div class="col-sm-12" v-html="xuzhi.gonggaoneirong">

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>-->

        <div class="row">

            <div class="col-sm-8" v-if="xiaoxiCount!=0">
                <div class="ibox float-e-margins">
                    <div class="ibox-title" style="height: 60px;">
                        <h5 v-text="'新消息（'+xiaoxiCount+')'" style="line-height: 30px;"></h5>
                        <div class="ibox-tools">
                            <button class="btn btn-success btn-md" @click="toXiaoxi()">查看新消息</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover no-margins" style="text-align: center">
                            <thead>
                                <tr>
                                    <th style="text-align: center">消息标题</th>
                                    <th style="text-align: center">发送人</th>
                                    <th style="text-align: center">发送时间</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for="xiaoxi in xiaoxiList">
                                    <td v-text="xiaoxi.biaoti"></td>
                                    <td v-text="xiaoxi.fasongren"></td>
                                    <td v-text="xiaoxi.fasongshijian"></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>


            <div class="col-sm-4" v-if="daihechaCount!=0">
                <div class="ibox float-e-margins">
                    <div class="ibox-title" style="height: 60px;">
                        <h5 v-text="'待核查专家（'+daihechaCount+')'" style="line-height: 30px;"></h5>
                        <div class="ibox-tools">
                            <button class="btn btn-success btn-md" @click="toHecha()">处理待核查</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-hover no-margins" style="text-align: center">
                            <thead>
                            <tr>
                                <th style="text-align: center">专家姓名</th>
                                <th style="text-align: center">工作单位</th>
                            </tr>
                            </thead>
                            <tbody>
                                <tr v-for="daihecha in daihechaList">
                                    <td v-text="daihecha.xingming"></td>
                                    <td v-text="daihecha.gongzuodanwei"></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

        </div>


    </div>
</div>

<th:block th:include="include :: footer" />
<script>
    var vm_index = new Vue({
        el : "#index",
        data : {
            deptid : $("#deptid").val(),		// deptid
            olddeptid : $("#olddeptid").val(),		// olddeptid
            deptname : $("#deptname").val(),		// deptname
            userid : $("#userid").val(),
            username : $("#username").val(),
            roleid : $("#roleid").val(),

            welcomeText : '',

            xiaoxiList : [],
            xiaoxiCount : '',
            daihechaList : [],
            daihechaCount : '',
            xuzhi : {},

        },
        created : function(){
            var _this = this;

            _this.bindWelcome();
            _this.bindXiaoxiList();
            _this.bindDaihechaList();
            _this.bindXuzhi();

        },
        methods : {

            bindWelcome :function(){
                var _this = this;

                var juese = '普通管理员';

                if (_this.roleid=='100'||_this.roleid=='102'){
                    juese = '超级管理员';
                }

                _this.welcomeText = _this.username + '同志，您好！您是'+ _this.deptname +'的' + juese + '，欢迎使用本系统！';


            },

            //
            bindXiaoxiList : function(){
                var _this = this;

                var index_layer = layer.open({type:3});
                $.post('/system/xiaoxi/inBoxWeidulist', {
                    userid : _this.userid,
                    rdm : Math.random()
                },function(ppData) {
                    layer.close(index_layer);
                    if (ppData.code == 0) {
                        _this.xiaoxiList = ppData.rows;
                        _this.xiaoxiCount = ppData.total;
                    }
                },"json");
            },

            bindDaihechaList : function(){
                var _this = this;

                var index_layer = layer.open({type:3});
                $.post('/system/zhuanjiaqushiqueren/list', {
                    jigoudaima : _this.olddeptid,
                    shifouchuli : '0',
                    rdm : Math.random()
                },function(ppData) {
                    layer.close(index_layer);
                    if (ppData.code == 0) {
                        _this.daihechaList = ppData.rows;
                        _this.daihechaCount = ppData.total;
                    }
                },"json");
            },


            bindXuzhi : function(){
                var _this = this;

                var index_layer = layer.open({type:3});
                $.post('/system/gonggao/findNewestByLeixing', {
                    gonggaoleixing : '3',
                    rdm : Math.random()
                },function(ppData) {
                    layer.close(index_layer);
                    if (ppData.result==1) {
                        _this.xuzhi = ppData.resultContent;
                    }
                },"json");
            },

            toXiaoxi : function(){
                $.modal.openTab("收件箱",'/system/xiaoxi/inBox',false);
            },

            toHecha : function(){
                $.modal.openTab("专家变动状态申报",'/system/zhuanjiabiandongdetail/customzhuanjiabiandongdetail',false);
            }
        },
    })
</script>

</body>

